package com.onemore.keyword.receiver;

import com.onemore.keyword.service.KeyWordService;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class ScreenReceiver extends BroadcastReceiver
{
    public static boolean wasScreenOn = true;
    public static final String SCREEN_ON = "SCREEN_ON";
    public static final String SCREEN_OFF = "SCREEN_OFF";
   
    
    @Override
    public void onReceive(Context context, Intent intent)
    {
        // TODO Auto-generated method stub
        if( intent.getAction().equals(Intent.ACTION_SCREEN_ON) )
        {
            Intent i = new Intent(context,KeyWordService.class);
            i.putExtra("MSG",SCREEN_ON);
            context.startService(i);
            wasScreenOn = false;
        }
        else    //on
        {
            Intent i = new Intent(context,KeyWordService.class);
            i.putExtra("MSG",SCREEN_OFF);
            context.startService(i);
            wasScreenOn = true;            
        }
    }
    
}
